package com.zzq.common.exception;

/**
 * @author ZZQ
 * @date 2019/3/9 下午 4:31
 */
public enum EmBusinessError implements CommonError {

    // 通用错误类型00001
    PARAMETER_VALIDATION_ERROR(10001, "参数不合法"),
    UNKNOWN_ERROR(10002, "未知错误"),

    // 20000开头为用户信息相关错误定义
    USER_NOTEXIST(20001, "用户不存在"),
    USER_EXIST(20001, "用户已经存在"),
    USER_LOGIN_FAIL(200002, "用户手机号或密码不正确"),
    USER_STATUS_INVALID(200003, "用户还未登录"),

    // 30000开头为角色信息错误
    ROLE_NOTEXIST(30001, "角色不存在"),
    ROLE_EXIST(30002, "角色已经存在");

    private EmBusinessError(int errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    private final int errCode;
    private String errMsg;

    @Override
    public int getErrCode() {
        return this.errCode;
    }

    @Override
    public String getErrMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
